/**
 * @Author Stringzhua
 * @Date 2024/11/4 11:50
 * description:
 */
public class Demo06 {
    public static void main(String[] args) {
        DeadLockWithSemaphore deadLock = new DeadLockWithSemaphore();
        Thread t1 = new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    deadLock.add();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        });
        Thread t2 = new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    deadLock.dec();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        });

        t1.start();
        t2.start();
    }
}
